feat: add lapack/base/dlasv2#2819
Conversation
Coverage Report
The above coverage report was generated for the changes in this PR. |
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: passed
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
@kgryte I have made some changes and would like to know your thoughts on the same. |
| * | ||
| * @private | ||
| */ | ||
| function main() { |
There was a problem hiding this comment.
@prajjwalbajpai This benchmarks needs to be refactored. The min/max iteration is pointless as the benchmark is not parameterized. We should use the unparameterized version of benchmarks.
| * @private | ||
| * @returns {Function} benchmark function | ||
| */ | ||
| function createBenchmark( ) { |
There was a problem hiding this comment.
@prajjwalbajpai Same thing. This benchmark is incorrect.
| * | ||
| * var out = new Float64Array( 6 ); | ||
| * | ||
| * out = dlasv2( 2.0, 3.0, 4.0, out ); |
There was a problem hiding this comment.
| * out = dlasv2( 2.0, 3.0, 4.0, out ); | |
| * dlasv2( 2.0, 3.0, 4.0, out ); |
No need to overwrite out here. Applies here and throughout this PR.
| * var out = new Float64Array( 6 ); | ||
| * | ||
| * out = dlasv2( 2.0, 3.0, 4.0, out ); | ||
| * // out => <Float64Array>[ 1.5513263285176897, 5.1568776039816795, 0.9664996487646696, 0.25666793515702424, 0.7496781758158659, 0.6618025632357402 ] |
There was a problem hiding this comment.
We should be using approximate values (e.g., ~1.5513), rather than full-precision, in order to guard against implementation drift invalidating all documentation. Applies here and throughout this PR.
There was a problem hiding this comment.
@prajjwalbajpai This still needs to be updated to use approximate values. E.g.,
// out => <Float64Array>[ ~1.5513, ~4.1569, ... ]This comment applies here and everywhere else.
| > var out = new {{alias:@stdlib/array/float64}}( 6 ); | ||
| > {{alias}}( 2.0, 3.0, 4.0, out ); | ||
| > out[ 0 ] | ||
| 1.5513263285176897 |
There was a problem hiding this comment.
Same thing. Use approximate values.
| buffer, the offset parameters support indexing semantics based on starting | ||
| indices. |
There was a problem hiding this comment.
| buffer, the offset parameters support indexing semantics based on starting | |
| indices. | |
| buffer, the offset parameter support indexing semantics based on a starting | |
| index. |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
| expected = new Float64Array( [ 1.0, PINF, 0.0, 1.0, 0.0, 1.0 ] ); | ||
| out = new Float64Array( 6 ); | ||
| out = dlasv2( PINF, 2.0, 1.0, out ); | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
|
|
||
| dlasv2( data.F, data.G, data.H, out ); | ||
| expected = data.out; | ||
| isApprox( t, out, expected, 1.0 ); |
There was a problem hiding this comment.
| isApprox( t, out, expected, 1.0 ); | |
| isApprox( t, out, expected, 1 ); |
| * @param {Object} t - test object | ||
| * @param {Collection} actual - actual values | ||
| * @param {Collection} expected - expected values | ||
| * @param {number} rtol - relative tolerance |
There was a problem hiding this comment.
All the same changes as proposed for the other test file.
| t.end(); | ||
| }); | ||
|
|
||
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (Negative Stride)', function test( t ) { |
There was a problem hiding this comment.
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (Negative Stride)', function test( t ) { | |
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (negative stride)', function test( t ) { |
Applies here and below.
| t.end(); | ||
| }); | ||
|
|
||
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (Offset)', function test( t ) { |
There was a problem hiding this comment.
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (Offset)', function test( t ) { | |
| tape( 'the function computes the singular value decomposition of a triangular matrix with elements in increasing order (offset)', function test( t ) { |
Applies here and below.
|
|
||
| <section class="intro"> | ||
|
|
||
| The singular value decomposition of a 2x2 upper triangular matrix $ \begin{bmatrix} F & G \\ 0 & H \end{bmatrix}$ is given by - |
There was a problem hiding this comment.
| The singular value decomposition of a 2x2 upper triangular matrix $ \begin{bmatrix} F & G \\ 0 & H \end{bmatrix}$ is given by - | |
| The singular value decomposition of a 2x2 upper triangular matrix $ \begin{bmatrix} F & G \\ 0 & H \end{bmatrix}$ is given by |
kgryte
left a comment
There was a problem hiding this comment.
Left another round of comments. This is coming along.
@prajjwalbajpai Thank you for improving the tests. They are muuuuuch better. 🙌
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: passed
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: passed
- task: lint_license_headers
status: passed
---
|
Made the changes. |
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
Co-authored-by: Athan <kgryte@gmail.com> Signed-off-by: Athan <kgryte@gmail.com>
| * @param {Collection} expected - expected values | ||
| * @param {number} maxULPs - maximum allowed ULP difference | ||
| */ | ||
| function isApprox( t, actual, expected, maxULPs ) { |
There was a problem hiding this comment.
I just recalled that this function is not necessary. You can replace all usage of isApprox below with @stdlib/assert/is-almost-same-float64array. Applies to this and the other test file.
There was a problem hiding this comment.
Done. One thing I found interesting was:
If I directly create the expected array as
expected = data.out;The isAlmostSameValueFloat64Array function was returning false. Hence, I had to wrap the array in Float64Array.
expected = new Float64Array( data.out );This is something that is not done in other routines where fixtures are used.
aayush0325
left a comment
There was a problem hiding this comment.
looks fine to me, please check the latex rendering issue!
| var Float64Array = require( '@stdlib/array/float64' ); | ||
| var dlasv2 = require( './../lib/' ); | ||
|
|
||
| var out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); |
There was a problem hiding this comment.
| var out = new Float64Array( [ 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 ] ); | |
| var out = new Float64Array( 6 ); |
| out[ offsetOut ] = ssmin; | ||
| out[ offsetOut + strideOut ] = ssmax; | ||
| out[ offsetOut + ( 2 * strideOut ) ] = snr; | ||
| out[ offsetOut + ( 3 * strideOut ) ] = csr; | ||
| out[ offsetOut + ( 4 * strideOut ) ] = snl; | ||
| out[ offsetOut + ( 5 * strideOut ) ] = csl; | ||
| return out; |
There was a problem hiding this comment.
the index calculation can be done in fewer ops here
|
|
||
| <section class="intro"> | ||
|
|
||
| The singular value decomposition of a 2x2 upper triangular matrix $ \begin{bmatrix} F & G \\ 0 & H \end{bmatrix}$ is given by |
There was a problem hiding this comment.
is it just me or is the latex rendering messed up for you guys as well @kgryte @prajjwalbajpai
There was a problem hiding this comment.
it would make sense to document how you're testing using fortran in a separate repository, like this repo this would help us both in terms of reviews and be a source of truth as more LAPACK PRs get queued for review over the next few weeks. imo its a good starting point, then we can consider keeping the fortran files itself in the repo but im not sure if that would achieve anything
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: passed
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: na
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: passed
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: passed
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---
|
|
||
| <!-- </equation> --> | ||
|
|
||
| where `CSL`,`SNL`,`CSR`,`SNR` define orthogonal rotations and $\mathrm{SSMAX}^2, \mathrm{SSMIN}^2$ are the eigenvalues of $A^{T}A$. |
There was a problem hiding this comment.
what is A here? assuming its the 2x2 input matrix you can write that above
---
type: pre_commit_static_analysis_report
description: Results of running static analysis checks when committing changes.
report:
- task: lint_filenames
status: passed
- task: lint_editorconfig
status: passed
- task: lint_markdown
status: passed
- task: lint_package_json
status: na
- task: lint_repl_help
status: na
- task: lint_javascript_src
status: na
- task: lint_javascript_cli
status: na
- task: lint_javascript_examples
status: na
- task: lint_javascript_tests
status: na
- task: lint_javascript_benchmarks
status: na
- task: lint_python
status: na
- task: lint_r
status: na
- task: lint_c_src
status: na
- task: lint_c_examples
status: na
- task: lint_c_benchmarks
status: na
- task: lint_c_tests_fixtures
status: na
- task: lint_shell
status: na
- task: lint_typescript_declarations
status: passed
- task: lint_typescript_tests
status: na
- task: lint_license_headers
status: passed
---

Towards #2464.
Description
This pull request adds JS implementation for
lapack/base/dlasv2Related Issues
NA
Questions
No.
Other
No.
Checklist
@stdlib-js/reviewers